<style lang="scss" scoped>
	@import '../style.scss';
	.entry_title{
		padding-left: 2vh;
		font-weight: bold;
		height:4vh;
		line-height: 4vh;
		font-size: 2vh;
		color:whitesmoke;
	}
	.entry{
		height:5vh;
		line-height: 5vh;
		font-size: 2vh;
		color:whitesmoke;
		padding-left: 2vh;
	}
// 	.entry >>> .ivu-rate-star span{
// 		height:40;
// 		background-color: greenyellow
// 	}


</style>
<template>
	<div class='my_card_outer' style="height:50vh">
		<div class='my_card' style="height:49vh;">
			<div class="my_card_title">
				<Icon type="md-stats" color='rgb(67,158,279)' class="my_card_icon" />租户健康度降序
			</div>
			<div style="height:44vh;width:100%">
				<Row>
					<Col span='3' class="entry_title">
					排名
					</Col>

					<Col span='7' class="entry_title">
					租户
					</Col>

					<Col span='14' class="entry_title">
					健康度
					</Col>
				</Row>
				<Row v-for="(item, index) in tenants" :key="index">
					<Col span='3' class='entry'>
					{{index+1}}
					</Col>

					<Col span='7' class='entry'>
					<div v-on:click="select_tenant(item.name)">{{item.name}}</div>
					</Col>

					<Col span='14' class='entry'>
					<Rate allow-half disabled v-model="item.rate" />
					</Col>
				</Row>

			</div>
		</div>

	</div>

</template>

<script>
	import echarts from 'echarts'
	import Axios from 'axios'
	import config from '../config.js'
	export default {
		name: 'diff_dim_rank',
		data() {
			return {
				tenants: [{
						name: "test1",
						rate: 4.6
					},
					{
						name: "test1",
						rate: 4.6
					},
					{
						name: "test1",
						rate: 4.6
					},
					{
						name: "test1",
						rate: 4.6
					},
					{
						name: "test1",
						rate: 3.6
					},
					{
						name: "test1",
						rate: 3.6
					},
					{
						name: "test1",
						rate: 3.6
					},
					{
						name: "test1",
						rate: 3.6
					}
				]
			}
		},
		mounted() {


		},
		methods: {
			initChart(data) {
				let tenant = []
				for (var i in data.tenant_sort) {
					tenant.push({
						name: data.tenant_sort[i]["tenant"],
						rate: data.tenant_sort[i]["health"] / 20
					})
				}
				this.tenants = tenant
			},
			select_tenant: function(tenant_name) {//选择某个租户，更新公共数据，
				console.log('diff_dim_rank-----', tenant_name)
				Axios.get(config.url+'/tenant?tenant='+tenant_name)
					.then(response => {
						// this.$store.state.data = response.data
						this.$store.commit('change_selected_tenant', response.data)
					})
					.catch(error => {
						console.log(error);
					});
			}

		}
	}
</script>
